package com.example.demo11.controller;

import com.example.demo11.domian.User2;
import com.example.demo11.domian.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;


@Controller
@RequestMapping("user")
public class UserController {

    @RequestMapping(value = "{userId}", method = RequestMethod.GET)
    public String getUser(@PathVariable("userId") String id, Model model){
        User2 user = new User2("coxx", "123456","coxx@vip.qq.com","jie");
        model.addAttribute("user", user);
        model.addAttribute("id", id);
        System.out.println("已经进入controller");
        return "user/index";
    }
}
